import http from '../../../util/http.js';


//订单主表Ajax前缀
const OrderMainPrefix = "/parking/order/main";


export function OrderMainList(pagination, param) {
    let url = `${OrderMainPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}


//根据订单ID 查询订单完整属性
export function OrderMainFind(orderId) {
    let url = `${OrderMainPrefix}/find/${orderId}`;
    return new Promise((resolve, reject) => {
        http.get(url).then(response => {
            resolve(response)
        });
    });
}






//修改
export function modifyPlateNo(data) {
    let url = `${OrderMainPrefix}/modify/plateNo`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}



//修改
export function modifyFee( data) {
    let url = `${OrderMainPrefix}/modify/fee`;
    return new Promise((resolve, reject) => {
        http.put(url, data).then(response => {
            resolve(response)
        });
    });
}















//=============================================


const TaskPrefix = "/parking/task";

export function taskList(pagination, param) {
    let url = `${TaskPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}


export function taskFind(id) {
    let url = `${TaskPrefix}/find/${id}`;
    return new Promise((resolve, reject) => {
        http.get(url).then(response => {
            resolve(response)
        });
    });
}


export function taskStop(id, data) {
    let url = `${TaskPrefix}/stop/${id}`;
    return new Promise((resolve, reject) => {
        http.put(url).then(response => {
            resolve(response)
        });
    });
}


export function taskDelete(id) {
    let url = `${TaskPrefix}/delete/${id}`;
    return new Promise((resolve, reject) => {
        http.delete(url).then(response => {
            resolve(response)
        });
    });
}


//=============================================


const ReviewPrefix = "/parking/review";

export function reviewList(pagination, param) {
    let url = `${ReviewPrefix}/list/${pagination.pageSize}/${pagination.current}`;
    return new Promise((resolve, reject) => {
        http.get(url, param).then(response => {
            resolve(response)
        });
    });
}

export function reviewFind(id) {
    let url = `${ReviewPrefix}/find/${id}`;
    return new Promise((resolve, reject) => {
        http.get(url).then(response => {
            resolve(response)
        });
    });
}


export function reviewReply(id, data) {
    let url = `${ReviewPrefix}/reply/${id}`;
    return new Promise((resolve, reject) => {
        http.post(url, data).then(response => {
            resolve(response)
        });
    });

}